package com.platform.boot.security.group.member;

import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.platform.boot.security.group.Group;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author <a href="https://github.com/vnobo">Alex bob</a>
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class GroupMemberOnly extends GroupMember {
    private String groupName;
    private JsonNode groupExtend;

    public static GroupMemberOnly withGroupMember(GroupMember tenantMember) {
        GroupMemberOnly groupMemberOnly = new GroupMemberOnly();
        BeanUtil.copyProperties(tenantMember, groupMemberOnly);
        return groupMemberOnly;
    }

    public GroupMemberOnly group(Group group) {
        this.setGroupName(group.getName());
        this.setGroupExtend(group.getExtend());
        return this;
    }
}